/*
 * Copyright (c) 2009. Silenus Consultoria, S.L.
 */
package es.silenus.detecta.dao.impl;

import es.silenus.detecta.dao.ProvinceDAO;

import es.silenus.detecta.model.Province;

import org.hibernate.Session;

import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


/**
 * DOCUMENT ME!
 *
 * @author <a href="mailto:dgarcia@silenus-consultoria.es">Daniel Garc&iacute;a</a>
 *
 * @since 02-abr-2009 12:13:12
 */
public class ProvinceDAOImpl extends ReadDAOImpl<Province, String> implements ProvinceDAO {
	/**
	 * Loads every single instance of a persistent class.
	 *
	 * @return list of instances.
	 */
	@Override
	@SuppressWarnings("unchecked")
	@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
	public List<Province> findAll() {
		Session session = null;

		try {
			session = getSession();

			return session.getNamedQuery(Province.class.getName() + ".findAll").list();
		} finally {
			releaseSession(session);
		}
	}
}
